home *** CD-ROM | disk | FTP | other *** search
-
-
-
- RRRRWWWWGGGGVVVVeeeeccccttttoooorrrr((((3333CCCC++++++++)))) RRRRWWWWGGGGVVVVeeeeccccttttoooorrrr((((3333CCCC++++++++))))
-
-
-
- NNNNaaaammmmeeee
- RWGVector(val) - Rogue Wave library class
-
- SSSSyyyynnnnooooppppssssiiiissss
- #include <rw/gvector.h>
-
-
-
- declare(RWGVector,vvvvaaaallll)
- implement(RWGVector,vvvvaaaallll)
- RWGVector(vvvvaaaallll) a; // A Vector of vvvvaaaallll''''ssss.
-
-
-
-
- DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
- Class RRRRWWWWGGGGVVVVeeeeccccttttoooorrrr((((vvvvaaaallll)))) represents a group of ordered elements, accessible
- by an index. Duplicates are allowed. This class is implemented as an
- array. Objects of type RRRRWWWWGGGGVVVVeeeeccccttttoooorrrr((((vvvvaaaallll)))) are declared with macros defined
- in the standard C++ header file <<<<ggggeeeennnneeeerrrriiiicccc....hhhh>>>>. Note that it is a vvvvaaaalllluuuueeee----
- bbbbaaaasssseeeedddd collection: items are copied in and out of the collection. The
- class vvvvaaaallll must have:
- a default constructor;
-
- well-defined copy semantics (vvvvaaaallll::::::::vvvvaaaallll((((ccccoooonnnnsssstttt vvvvaaaallll&&&&)))) or equiv.);
-
- well-defined assignment semantics (vvvvaaaallll::::::::ooooppppeeeerrrraaaattttoooorrrr====((((ccccoooonnnnsssstttt vvvvaaaallll&&&&)))) or
- equivalent).
-
-
- PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
- For each type of RRRRWWWWGGGGVVVVeeeeccccttttoooorrrr, you must include one (and only one) call to
- the macro iiiimmmmpppplllleeeemmmmeeeennnntttt, somewhere in your code. None
-
- EEEExxxxaaaammmmpppplllleeee
- #include <rw/gvector.h>
-
-
-
- #include <rw/rwdate.h>
- #include <rw/rstream.h>
-
-
- declare(RWGVector, RWDate) /* Declare a vector of dates */
-
-
-
- implement(RWGVector, RWDate) /* Implement a vector of dates */
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- RRRRWWWWGGGGVVVVeeeeccccttttoooorrrr((((3333CCCC++++++++)))) RRRRWWWWGGGGVVVVeeeeccccttttoooorrrr((((3333CCCC++++++++))))
-
-
-
- main() {
-
-
-
- RWGVector(RWDate) oneWeek(7);
- for (int i=1; i<7; i++)
- oneWeek(i) = oneWeek(0) + i;
-
-
- for (i=0; i<7; i++)
-
-
-
- cout << oneWeek(i) << endl;
-
-
-
- return 0;
-
-
-
- }
-
- Program output:
-
- 04/12/93
- 04/13/93
- 04/14/93
- 04/15/93
- 04/16/93
- 04/17/93
-
- PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
- 04/18/93
-
-
-
- RRRRWWWWGGGGVVVVeeeeccccttttoooorrrr((((vvvvaaaallll))))();
-
-
- Construct an empty vector.
-
- RRRRWWWWGGGGVVVVeeeeccccttttoooorrrr((((vvvvaaaallll))))(size_t n);
-
-
- Construct a vector with length nnnn. The initial values of the elements can
- (and probably will) be garbage.
-
- RRRRWWWWGGGGVVVVeeeeccccttttoooorrrr((((vvvvaaaallll))))(size_t n, vvvvaaaallll v);
-
-
- Construct a vector with length nnnn. Each element is assigned the value vvvv.
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- RRRRWWWWGGGGVVVVeeeeccccttttoooorrrr((((3333CCCC++++++++)))) RRRRWWWWGGGGVVVVeeeeccccttttoooorrrr((((3333CCCC++++++++))))
-
-
-
- RRRRWWWWGGGGVVVVeeeeccccttttoooorrrr((((vvvvaaaallll))))(RWGVector(vvvvaaaallll)& s);
-
-
- Copy constructor. The entire vector is copied, including all embedded
- values.
-
- PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr OOOOppppeeeerrrraaaattttoooorrrrssss
- RWGVector(val)&
- ooooppppeeeerrrraaaattttoooorrrr====(RWGVector(vvvvaaaallll)& s);
-
-
- Assignment operator. The entire vector is copied.
-
- RWGVector(vvvvaaaallll)&
- ooooppppeeeerrrraaaattttoooorrrr====(vvvvaaaallll v);
-
-
- Sets all elements of self to the value vvvv.
-
- vvvvaaaallll
- ooooppppeeeerrrraaaattttoooorrrr(((())))(size_t i) const;
- vvvvaaaallll&&&&
- ooooppppeeeerrrraaaattttoooorrrr()(size_t i);
-
-
- Return the iiii'th element in the vector. The index iiii must be between zero
- and the length of the vector less one. No bounds checking is performed.
- The second variant can be used as an lvalue.
-
- vvvvaaaallll
- ooooppppeeeerrrraaaattttoooorrrr[[[[]]]](size_t i) const;
- vvvvaaaallll&&&&
- ooooppppeeeerrrraaaattttoooorrrr[[[[]]]](size_t i);
-
-
- Return the iiiith element in the vector. The index iiii must be between zero
- and the length of the vector less one. Bounds checking is performed.
-
- PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
- const val*
- ddddaaaattttaaaa() const;
-
-
- Returns a pointer to the raw data of self. Should be used with care.
-
- size_t
- lllleeeennnnggggtttthhhh() const;
-
-
- Returns the length of the vector.
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-
-
-
- RRRRWWWWGGGGVVVVeeeeccccttttoooorrrr((((3333CCCC++++++++)))) RRRRWWWWGGGGVVVVeeeeccccttttoooorrrr((((3333CCCC++++++++))))
-
-
-
- void
- rrrreeeesssshhhhaaaappppeeee(size_t n);
-
-
- Resize the vector. If the vector shrinks, it will be truncated. If the
- vector grows, then the value of the additional elements will be
- undefined.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 4444
-
-
-
-